/* 本插件用来将矩阵转换成LaTeX公式以供复制黏贴到别处 
   安装方法请见https://zhuanlan.zhihu.com/p/639188316
*/
function toLatexMatrix(matrix) {
  let latexStr = "\\begin{bmatrix}\n";
  for (let row = 0; row < matrix.length; row++) {
    for (let col = 0; col < matrix[row].length; col++) {
      latexStr += matrix[row][col];
      if (col < matrix[row].length - 1) {
        latexStr += " & ";
      }
    }
    latexStr += " \\\\\n";
  }
  latexStr += "\\end{bmatrix}";
  return latexStr;
}

console.log(toLatexMatrix(get_current_matrix()))



